package learnjava.basic.javaIO.BIO;


import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

class Client{

    public static void main(String[] args) {

        try {
            Socket socket = new Socket("127.0.0.1",9000);
            OutputStream os = socket.getOutputStream();
            PrintWriter pw = new PrintWriter(os);

            Scanner sc= new Scanner(System.in);
            String msg;
            while ((msg=sc.nextLine())!=null){
                pw.println(msg);
                pw.flush();
                System.out.println("消息已发出");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
